time: 2021.3
# -*- coding: utf-8 -*-
# @Time    : 2021/4/20 21:42
# @Author  : luogan
# @Email   : 468640092@qq.com
# @File    : python冒泡排序.py
# @Software: PyCharm.
#   bubbleSort(冒泡排序)
#   使用python实现冒泡排序

def bubble_sort(alist):
    n = len(alist)
    for i in range(0,n-1):
        for j in range(0,n-1-i):
            if alist[j]>alist[j+1]:
                alist[j],alist[j+1] = alist[j+1],alist[j]
    return alist
li=[5,3,8,4,6]
print(bubble_sort(li))

